<?php
	require_once("sms_config.php");
	if (file_exists($file_name)) { 
		$sms_array = GetFromFile($file_name);
		$sms_count = count($sms_array);
	
		if ($sms_count > 0) {
			$a = 0;
			//$return = "<table border='0' cellpadding='2' cellspacing='0' width='100%'>\n"; //lenteles pradzia
			$kartoti = $sms_count - $sms_to_save;
			for($c = $sms_count; $c >= $kartoti; $c--) {
				$msg = @preg_replace( "`((http)+(s)?:(//)|(www\.))((\w|\.|\-|_)+)(/)?(\S+)?`i", "<a href=\"http\\3://\\5\\6\\8\\9\" title=\"\\0\" target=\"_blank\">\\5\\6</a>", input($sms_array[$c]));
				//if (!empty($msg)) { $return .= "<tr>\n\t<td>\n\t\t".$msg."\n</td>\n\t</tr>\n"; } //rodome skelbimus 
				if (!empty($msg)) { $return = $msg; } //rodome skelbimus 
				$a++;
			}
			unset($kartoti);
			//$return .= "</table>"; //lenteles pabaiga
		}
	} else {
		echo "klaida";
	}
	echo $return; //išvedame tekstą
	unset($msg,$return,$a,$sms_count,$a,$sms_array,$your_pass,$sms_to_save,$file_name,$keyword,$number,$intro_text,$c,$q);
?>
